<template>
	<view>
			<kenynavbar></kenynavbar>
		
		<view class="fixAuto   pt10" style="width: 1300px;margin: 0 auto; ">			
			<view class="w77p" style="width: 980px;">
				<view class="w100p">
					
					<view class="h100p whiteBg w980 shadow mt10 pd10 rds5" style="min-height: 500px;">
						
						<view>
						<view class="fz20 bold w100p tc brown m10">{{data.title}}</view>
						<view class="fz16 grey w100p tc">发布时间:{{data.createTimeStr}} 浏览量:{{data.view_count}} 分类：{{data.category}}   </view>
						</view>
						<view class="w100p hidden" >
							<jyf-parser :html="content" ref="article" class="wxParse"></jyf-parser>
							<!-- <rich-text :nodes="content" class="richtext"></rich-text> -->
						<!-- 	<u-parse :content="content" ></u-parse> -->
						</view>
					</view>
					
				</view>
			</view>
			<view class="w23p ">
				<view class="w100p rds5">
					<!-- <view class="h200 w100p shadow pd10">
						<view class="fz16  pd10 bold  brown bb">管理功能</view>
					</view> -->
				
				<kenycatelist title="文章分类"> </kenycatelist>
				<kenysearch></kenysearch>
				<kenynews title="推荐文章" issider="true" ishot="true"  pageNumber="1" pageSize="10" ></kenynews>
				<kenynews title="最新文章" issider="true"  pageNumber="1" pageSize="10" ></kenynews>
				</view>

			</view>
		</view>
		<kenyfoot></kenyfoot>

	</view>
</template>

<script>

	import jyfParser from "@/components/jyf-parser/jyf-parser";

	export default {
		components: {jyfParser},
		data() {
			return {
				conditions:{},
				content:'<p></p>',
				id:'',
				data:{}
			}
		},
		onLoad(e) {
			this.id = e.id;
			
			this.getinfo();
		},
		
		methods: {
			
			go(e){
				uni.navigateTo({
					url: e
				})
			},
			getinfo(){
				uni.showLoading({
					title:"加载中…"
				});
				let that = this ;
				let data = {
					id : this.id 
				};
				this.bcc.callInCache({
					url : 'api/article/info' ,
					data : data ,
					success : res => { 
						//console.log(res.data)
						this.data = res.data || {};
						
						this.data.createTimeStr = this.bcc.date.toStr(res.data.publish_date);
						
						// this.typeList = res.typeList ;
						// this.content=this.data.content.replace("<!DOCTYPE html>",'').replace("<html>",'').replace("<head>",'')
						// .replace("</head>",'').replace("<body>",'').replace("</body>",'').replace("</html>",'')
						this.content=this.data.content
						uni.hideLoading()
						
					}
				});
			},
			formatRichText (html) { //控制小程序中图片大小
						    let newContent= html.replace(/<img[^>]*>/gi,function(match,capture){
						        match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
						        match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
						        match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
						        return match;
						    });
						    newContent = newContent.replace(/style="[^"]+"/gi,function(match,capture){
						        match = match.replace(/width:[^;]+;/gi, 'max-width:400px;').replace(/width:[^;]+;/gi, 'max-width:400px;');
						        return match;
						    });
						    newContent = newContent.replace(/<br[^>]*\/>/gi, '');
						    newContent = newContent.replace(/\<img/gi, '<img style="max-width:600px;height:auto;display:inherit;margin:10rpx auto;"');
						    return newContent;
			}

		}
	}
</script>

<style>	


</style>
